package com.eonmind.common.provider.entity.ai;

import com.eonmind.common.contract.data.base.DbEntity;
import com.eonmind.common.contract.enums.DelEnum;
import com.eonmind.common.contract.enums.ai.ConversationTypeEnum;
import com.eonmind.common.contract.timer.Timer;
import com.mongoplus.annotation.ID;
import com.mongoplus.annotation.collection.CollectionName;
import com.mongoplus.annotation.index.MongoIndex;
import com.mongoplus.annotation.index.MongoTextIndex;
import com.mongoplus.enums.IdTypeEnum;
import lombok.Data;
import lombok.ToString;
import lombok.experimental.FieldNameConstants;

/**
 * 用户会话
 *
 * @author Xujie
 * @since 2025/5/5 10:38
 **/
@Data
@CollectionName("aiConversation")
@MongoTextIndex(fields = {"title"})
@FieldNameConstants
@ToString
public class AiConversation implements DbEntity {
    /**
     * 会话id
     */
    @ID(type = IdTypeEnum.AUTO)
    private Long id;

    /**
     * 会话类型
     */
    @MongoIndex
    private Integer type = ConversationTypeEnum.AI_CHAT.getCode();

    /**
     * 会话标题
     */
    private String title = "";

    /**
     * 总消耗token
     */
    @MongoIndex
    private Long totalToken = 0L;

    /**
     * 用户id
     */
    @MongoIndex
    private Long userId;

    /**
     * 创建时间
     */
    private Long createTime = Timer.currentTimestamp();

    /**
     * 更新时间
     */
    private Long updateTime = Timer.currentTimestamp();

    /**
     * 删除状态
     */
    @MongoIndex
    private Integer del = DelEnum.UN_DEL.getCode();
}
